﻿@model FormCollection

@{
    ViewBag.Title = "Create Data Record";
}

<h2>New Data Record for @ViewBag.TableName</h2>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Data Record</legend>
        
        @foreach(string col in ViewBag.ColumnNames)
        {
            if(col != "DataID") 
            {
                <div class="editor-label">
                    @Html.Label(col)
                    @Html.Hidden("FieldName", col)
                </div>
                <div class="editor-field">
                    @Html.Editor("FieldValue_" + col)
                </div>
             }
        }

        <p>
           <input type="hidden" name="TableMasterID" value="@ViewBag.TableMasterID" /> 
           <input type="hidden" name="DataID" value="@ViewBag.DataID" />
           <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index", new { id = ViewBag.TableMasterID })
</div>


        @{Html.RenderAction("_ListDataTables", "DataTable");}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
